package com.springboot.SpringBoot1.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/****
 * 演示异步调用
 */
@Service
@Slf4j
public class MemberService {
    @Async //相当于单独开启一个线程来执行
    public String addMemberAndEmail(){
      log.info("添加用户的时候发送email");
      log.info("2");
      try{
          Thread.sleep(500);
      }catch (Exception e){

      }
      log.info("3");
      return "添加用户发送邮件";
    }
}
